function AVA_DUG_LFM_P1
%% DEFINE FOLDER PATH
ProjectPath = 'G:\backup_win_d\ava_inversion\apb17\';
InputPath   = 'input\';
OutputPath  = 'output_RHO_HD_LFM\';
noSim           = 32;
noIt            = 6;
MinLayerSize    = 10;
MaxLayerSize    = 20;
xMax            = 1;
yMax            = 1613;
zMax            = 801;

%% LOAD HARD DATA
% SEISMIC [cell] 
seis_file       = 'apb17_flattened.mat';
load([ProjectPath,InputPath,seis_file]);

% ANGLES [1 x nAngles]
angles = 1:55;
rangeOfAngles = [1 size(angles,1)]
% CREATE WEIGHTING VECTORS - LOCAL CORRELATION
WeightDen           = ones(1,size(angles,2));
WeightVp            = ones(1,size(angles,2));
WeightVs            = ones(1,size(angles,2));

WeightDen(1,:)      = WeightDen./numel(angles);
WeightVp(1,:)       = WeightVp./numel(angles);
WeightVs(1,:)       = WeightVs./numel(angles);

% WAVELET [n x nAngles]
wavelet_file        = 'wavelets.mat';
load([ProjectPath,InputPath,wavelet_file]); % LOAD WAVELET
GatherWavelet       = (wavelets)'; 

% ZONES
ZoneFile            = 'zonesAVA.sgems';
NbrZones            = 2;

% LOAD HARD-DATA TO CHECK IF EXISTS
for i=1: NbrZones
    
    DenHD(i,:)      = [ProjectPath, InputPath,'coord',num2str(i),'_rho_LFM.gslib'];
    VpHD(i,:)       = [ProjectPath, InputPath,'coord',num2str(i),'_vp_372_densOK.gslib'];
    VsHD(i,:)       = [ProjectPath, InputPath,'coord',num2str(i),'_vs_372_densOK.gslib'];

    JointDVp(i,:)   = [ProjectPath, InputPath,'bihist',num2str(i),'_vpvs_new.gslib'];
    JointVpVs(i,:)  = [ProjectPath, InputPath,'bihist',num2str(i),'_vsd_new.gslib'];
end

WeightSeismic = 0.2;
%% USER DEFINED PARAMETERS
% GLOBAL CORRELATION DEFINITION
NbrClassesBihist    = 15;
SimType             = 'SGEMS'; % SGEMS or GEOEAS

% GRID PARAMETERS - NO. CELLS; ORIGIN; SPACING
XX                  = [xMax 1  1];
YY                  = [yMax 1  1];
ZZ                  = [zMax 1  1];

%% STOCHASTIC SIMULATION PARAMETERS
% SEARCHING ELLIPSOID
VariogramType       = [3; 3; 3;...
                       3; 3; 3];
                   
VarNugget           = [0   0   0;...
                       0   0   0];

KrigAngDen          = [0 0 0;0 0 0];
KrigRangeDen        = [400 400 15;400 400 15];

KrigAngVp           = [0 0 0;0 0 0];
KrigRangeVp         = [400 400 15;400 400 15];

KrigAngVs           = [0 0 0;0 0 0];
KrigRangeVs         = [400 400 15;400 400 15];

VarRangeDen         = [8 8 2 1;...
                       8 8 2 1];
                   
VarAngDen           = [0 0 0;0 0 0];

VarRangeVp          = [8 8 2 1;...
                       8 8 2 1];
                   
VarAngVp            = [0 0 0;0 0 0];

VarRangeVs          = [8 8 2 1;...
                       8 8 2 1];
                    
VarAngVs            = [0 0 0;0 0 0];

CovTab              = [100 100 50;...
                       100 100 50];

WeightsSelection    = [0 0.1 0 0.9;
                       0 0.1 0 0.9];

NullDataValue       = -99999.25;

MeanModelFilename(1,:)  = ['DeFlat.gslib'];
MeanModelFilename(2,:)  = ['VpFlat.gslib'];
MeanModelFilename(3,:)  = ['VsFlat.gslib'];

execute_AVAinv_fixed_dens(ProjectPath, InputPath, OutputPath, XX, YY, ZZ,...
    MinLayerSize, MaxLayerSize, WeightDen, WeightVp, WeightVs,...
    noIt, noSim, DenHD, VpHD, VsHD, JointDVp,...
    JointVpVs, KrigAngDen, KrigRangeDen, KrigAngVp, KrigRangeVp, KrigAngVs,...
    KrigRangeVs, VarAngDen, VarRangeDen, VarAngVp, VarRangeVp, VarAngVs, ...
    VarRangeVs, ZoneFile, NbrZones, VariogramType, VarNugget, SimType,...
    NbrClassesBihist, CovTab, SeisFlat, angles,rangeOfAngles, GatherWavelet, WeightsSelection, ...
    NullDataValue, 1, 0, WeightSeismic, MeanModelFilename);
end    